package cn.leedsoft.and.crimeintent.model.run_tracker;

import java.util.Date;

/**
 * Created by leeds on 2016/9/5 17:37.
 */
public class Run {
    private long mId;
    private Date mStartDate;

    public Run() {
        mStartDate = new Date();
    }

    public Date getStartDate() {
        return mStartDate;
    }

    public void setStartDate(Date startDate) {
        mStartDate = startDate;
    }

    public int getDurationSeconds(long endMilli) {
        return (int)((endMilli - mStartDate.getTime())/1000);
    }

    public static String formatDurationSeconds(int durationSeconds) {
        int seconds = durationSeconds % 60;
        int minutes = (durationSeconds-seconds)/60 % 60;
        int hours = (durationSeconds - seconds - minutes*60)/(60*60);
        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
    }

    public static void main(String[] args) {
        System.out.println(formatDurationSeconds(3661));
//        System.out.println(60 % 3600);
    }

    public long getId() {
        return mId;
    }

    public void setId(long id) {
        mId = id;
    }
}
